package com.bw.jetpacktest.databinding;

import android.os.Bundle;
import android.view.View;

import androidx.annotation.Nullable;
import androidx.appcompat.app.AppCompatActivity;
import androidx.databinding.DataBindingUtil;
import androidx.databinding.ObservableField;

import com.bw.jetpacktest.BR;
import com.bw.jetpacktest.R;

public class OnceActivity extends AppCompatActivity {
    private ActivityOnceBinding binding;
    public Entity entity = new Entity();
    @Override
    protected void onCreate(@Nullable Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        binding = DataBindingUtil.setContentView(this, R.layout.activity_once);
        binding.setVariable(BR.value,entity);
        binding.getRoot().findViewById(R.id.change_btn).setOnClickListener(new View.OnClickListener() {
            @Override
            public void onClick(View view) {
                entity.msg.set("hehe");
            }
        });
    }

    @Override
    protected void onDestroy() {
        super.onDestroy();
        binding.unbind();
    }
}
